﻿<UserControl x:Class="KouDai.Phone.Views.RankingListView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:WPNext="clr-namespace:WPNextTools.NControls;assembly=WPNextTools"
             xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
             xmlns:control="clr-namespace:KouDai.Phone.Controls"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
             xmlns:vm="clr-namespace:KouDai.Phone.ViewModels"
             FontFamily="{StaticResource PhoneFontFamilyNormal}"
             FontSize="{StaticResource PhoneFontSizeNormal}"
             Foreground="{StaticResource PhoneForegroundBrush}"
             cal:Bind.AtDesignTime="True"
             d:DataContext="{d:DesignInstance Type=vm:RankingListViewModel,
                                              IsDesignTimeCreatable=True}"
             d:DesignHeight="800"
             d:DesignWidth="480"
             mc:Ignorable="d">
    <UserControl.Resources>
        <DataTemplate x:Key="HotHoneyDataTemplate">
            <Button Width="190"
                    Height="250"
                    Margin="0,12,18,12"
                    HorizontalContentAlignment="Stretch"
                    VerticalContentAlignment="Stretch"
                    Background="Transparent"
                    BorderThickness="0"
                    Padding="0"
                    Style="{StaticResource NoBorderNoThicknessButtonStyle}">
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="Click">
                        <cal:ActionMessage MethodName="RankSelectExecute">
                            <cal:Parameter Value="$dataContext" />
                        </cal:ActionMessage>
                    </i:EventTrigger>
                </i:Interaction.Triggers>

                <Grid Width="200" Height="250">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="200" />
                        <RowDefinition Height="50" />
                    </Grid.RowDefinitions>
                    <Image x:Name="HoneyImage"
                           Source="{Binding ImageUrlForIphone}"
                           Stretch="UniformToFill" />
                    <Image x:Name="AngleImage"
                           Width="50"
                           Height="50"
                           HorizontalAlignment="Left"
                           VerticalAlignment="Top"
                           Source="/Images/kd_hot_angle.png"
                           Stretch="Fill" />
                    <TextBlock x:Name="Num"
                               Width="25"
                               Height="30"
                               Margin="5,0,0,0"
                               HorizontalAlignment="Left"
                               VerticalAlignment="Top"
                               FontSize="24"
                               Text="{Binding Num}" />
                    <StackPanel Grid.Row="1"
                                Height="50"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Bottom"
                                Orientation="Horizontal">
                        <TextBlock VerticalAlignment="Center"
                                   FontSize="26.667"
                                   Foreground="{StaticResource HotListDarkBrush}"
                                   Text="收藏数：" />
                        <TextBlock x:Name="FavCount"
                                   VerticalAlignment="Center"
                                   Foreground="{StaticResource TextColorLightBrush}"
                                   Text="{Binding FaviorateAmout}" />
                    </StackPanel>
                </Grid>
            </Button>

        </DataTemplate>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <WPNext:PullDownToRefreshPanel x:Name="PullDownRefreshPanel" cal:Message.Attach="[Event ScrollPushed] = [Action PullDownRefresh]" />
        <ListBox x:Name="RankingList" ItemsSource="{Binding Items}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel IsHitTestVisible="False" Orientation="Horizontal">
                        <StackPanel Width="40" Orientation="Vertical">
                            <Image Width="40"
                                   Height="40"
                                   VerticalAlignment="Top"
                                   Source="/Images/kd_hot_timeline.png" />
                            <Grid Height="1355" Margin="10,0">
                                <Ellipse Width="7"
                                         Height="7"
                                         Margin="0,8,0,0"
                                         VerticalAlignment="Top"
                                         Fill="{StaticResource HotListLightBrush}" />
                                <Border Width="5"
                                        Background="{StaticResource HotListLightBrush}"
                                        BorderThickness="1" />
                            </Grid>
                        </StackPanel>
                        <StackPanel Width="440" Orientation="Vertical">
                            <StackPanel Margin="0" Orientation="Horizontal">
                                <TextBlock FontSize="24"
                                           FontWeight="Bold"
                                           Foreground="{StaticResource HotListDarkBrush}"
                                           Text="{Binding Date}" />
                                <TextBlock VerticalAlignment="Center"
                                           FontSize="20"
                                           Foreground="{StaticResource HotListLightBrush}"
                                           Text="{Binding UpdateTimeTip}" />
                            </StackPanel>
                            <ItemsControl ItemTemplate="{StaticResource HotHoneyDataTemplate}"
                                          ItemsPanel="{StaticResource WrapPanelTemplate}"
                                          ItemsSource="{Binding HoneyItems}" />
                        </StackPanel>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</UserControl>